/*
 * Copyright (c)
 * All rights reserved.
 * OrderIssueEntity.java
 */

package com.ueboot.weishop.entity.order;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * 描述: 订单下放下游系统
 *
 * @author Yvan
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_ORDER_ISSUE")
public class OrderIssueEntity extends IDEntity {

	//发送DMS标识记录操作枚举；0 新增，1 自动取消，2 人工取消
	public static final String CANCER_0 = "0";
	public static final String CANCER_1 = "1";
	public static final String CANCER_2 = "2";

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_ORDER_ISSUE")
	@GenericGenerator(name = "WS_ORDER_ISSUE", strategy = "enhanced-table", parameters = {
			@org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
			@org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_ORDER_ISSUE"),
			@org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
	@Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
	private Long id;

	/**
	 * 批处理批次号
	 */
	@Column(name = "BATCH_NO", columnDefinition = "VARCHAR(40) COMMENT '批处理批次号'", length = 40)
	private String batchNo;

	/**
	 * 唯一标示 代金券编号
	 */
	@Column(name = "SEQ_NO", columnDefinition = "VARCHAR(50) COMMENT '唯一标示'", length = 50)
	private String seqNo;

	/**
	 * 订单编号
	 */
	@Column(name = "ORDER_NO", columnDefinition = "VARCHAR(200) COMMENT '唯一标示'", length = 200)
	private String orderNo;
	/**
	 * 电子账户名称
	 */
	@Column(name = "NAME", columnDefinition = "VARCHAR(50) COMMENT '电子账户名称'", length = 50)
	private String name;

	/**
	 * 微信号唯一标识
	 */
	@Column(name = "OPEN_ID", columnDefinition = "VARCHAR(50) COMMENT '微信号唯一标识'", length = 50)
	private String openId;
	/**
	 * VIN码
	 */
	@Column(name = "VIN", columnDefinition = "VARCHAR(30) COMMENT 'VIN码'", length = 30)
	private String vin;
	/**
	 * 活动编号
	 */
	@Column(name = "CAMPAIGN_CODE", columnDefinition = "VARCHAR(40) COMMENT '活动编号'", length = 40)
	private String campaignCode;
	/**
	 * 总金额
	 */
	@Column(name = "AMOUNT", columnDefinition = "VARCHAR(40) COMMENT '总金额'", length = 40)
	private String amount;
	/**
	 * 已使用金额 默认0
	 */
	@Column(name = "USE_AMOUNT", columnDefinition = "VARCHAR(40) COMMENT '已使用金额 默认0'", length = 40)
	private String useAmount = "0.0";
	/**
	 * 开始生效日期
	 */
	@Column(name = "VALID_BEGIN_DATE", columnDefinition = "VARCHAR(40) COMMENT '开始生效日期'", length = 40)
	private String validBeginDate;
	/**
	 * 结束生效日期
	 */
	@Column(name = "VALID_END_DATE", columnDefinition = "VARCHAR(40) COMMENT '结束生效日期'", length = 40)
	private String validEndDate;
	/**
	 * 目标（责任）经销商服务代码
	 */
	@Column(name = "TARGET_DEALER", columnDefinition = "VARCHAR(40) COMMENT '目标（责任）经销商服务代码'", length = 40)
	private String targetDealer;
	/**
	 * 使用经销商服务代码
	 */
	@Column(name = "USE_DEALER", columnDefinition = "VARCHAR(40) COMMENT '使用经销商服务代码'", length = 40)
	private String useDealer = null;
	/**
	 * 门槛金额
	 */
	@Column(name = "LOWEST_AMOUNT", columnDefinition = "VARCHAR(40) COMMENT '门槛金额'", length = 40)
	private String lowestAmount = "0.0";
	/**
	 * 抵扣限额
	 */
	@Column(name = "LIMIT_DEDUCT", columnDefinition = "VARCHAR(40) COMMENT '抵扣限额'", length = 40)
	private String limitDeduct = "0.0";

	/**
	 * 发送DMS状态：待发送；已发送
	 */
	@Column(name = "SEND_DMS_STATUS", columnDefinition = "VARCHAR(40) COMMENT '发送DMS状态：待发送；发送中；已发送'", length = 40)
	private String sendDmsStatus = OrderEnum.SEND_STATUS_0;

	/**
	 * 最近一次发送DMS时间
	 */
	@Column(name = "LAST_SEND_DMS_TIME", columnDefinition = "DATE COMMENT '最近一次发送DMS时间'")
	private Date lastSendDmsTime;

	/**
	 * 发送DMS的次数，超过3次就不做查询发送
	 */
	@Column(name = "SEND_DMS_COUNT", columnDefinition = "INT(1) COMMENT '发送DMS的次数，超过3次就不做查询发送'", length = 1)
	private Integer sendDmsCount;

	/**
	 * 发送DMS的响应结果。
	 */
	@Column(name = "DMS_RESULT", columnDefinition = "VARCHAR(200) COMMENT '发送DMS的响应结果。'", length = 200)
	private String dmsResult;

	/**
	 * 发送历史记录
	 */
	@Column(name = "SEND_DMS_HISTORY", columnDefinition = "VARCHAR(2000) COMMENT '发送历史记录'", length = 2000)
	private String sendDmsHistory;

	/**
	 * 发送操作：0 新增，1 自动取消，2 主动取消
	 */
	@Column(name = "CANCEL", columnDefinition = "VARCHAR(1) COMMENT '发送操作：0 新增，1 自动取消，2 主动取消'", length = 1)
	private String cancel = CANCER_0;

	/**
	 * 发送短信状态：待发送；发送中；已发送
	 *
	 * @see OrderEnum
	 */
	@Column(name = "SEND_SMS_STATUS", columnDefinition = "VARCHAR(15) COMMENT '发送短信状态：待发送；发送中；已发送'", length = 15)
	private String sendSmsStatus;

	/**
	 * 发送消息推送时间
	 *
	 */
	@Column(name = "SEND_SMS_TIME", columnDefinition = "Date COMMENT '发送消息推送时间'")
	private Date sendSmsTime;

	/**
	 * 认证车主手机号
	 */
	@Column(name = "CUSTOMER_MOBILE", columnDefinition = "VARCHAR(11) COMMENT '认证车主手机号'", length = 11)
	private String customerMobile;

	/**
	 * 认证车主手机号
	 */
	@Column(name = "GOODS_NAME", columnDefinition = "VARCHAR(11) COMMENT '认证车主手机号'", length = 11)
	private String goodsName;
}